package com.sunwayhorizo.health.hl7.rim;

import java.io.*;
import javax.persistence.*;
import com.sunwayhorizo.health.hl7.common.*;
import com.sunwayhorizo.health.hl7.datatypes.*;
import com.sunwayhorizo.health.hl7.persistent.*;
import static com.sunwayhorizo.health.hl7.vocabulary.EntityCdSetCode.*;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("LCOM")
public class LanguageCommunication extends Hl7Entity implements Serializable
{

    /**
     * 
     */
    protected static final long serialVersionUID = 1L;


    /*
     * public CE LanguageCode; public CE ModeCode; public BL PreferenceInd;
     * public CE ProficiencyLevelCode;
     */
    public LanguageCommunication() throws Hl7Exception
    {
    }


    public void setLanguageCode(CE ce)
    {
        if (null != ce && ce.codeSystemEnName() != null && ce.codeName() != null)
        {
            setRimCoreEntyCdSets(ce, LANGUAGECODE);
        }
        else
        {
            this.setLcLanguageCodeEtsId(ce.code().toString());
        }

    }


    public CE getLanguageCode() throws Hl7Exception
    {
        if (this.getLcLanguageCodeEtsId().equals(LANGUAGECODE.toString()))
        {
            for (RimCoreEntyCdSets entityCdSets : this.getEntyCdSetsList())
            {
                if (this.getLcLanguageCodeEtsId().equals(entityCdSets.getAttributeTypeCode()))
                {
                    return DataTypeUtil.getCE(entityCdSets);
                }
            }
        }
        else
            return DataTypeUtil.getCE(this.getLcLanguageCodeEtsId());
        return null;

    }


    public void setModeCode(CE ce)
    {
        if (null != ce && ce.codeSystemEnName() != null && ce.codeName() != null)
        {
            setRimCoreEntyCdSets(ce, MODECODE);
        }
        else
        {
            this.setLcModeCodeEtsId(ce.code().toString());
        }
    }


    public CE getModeCode() throws Hl7Exception
    {
        if (this.getLcModeCodeEtsId().equals(MODECODE.toString()))
        {
            for (RimCoreEntyCdSets entityCdSets : this.getEntyCdSetsList())
            {
                if (this.getLcModeCodeEtsId().equals(entityCdSets.getAttributeTypeCode()))
                {
                    return DataTypeUtil.getCE(entityCdSets);
                }
            }
        }
        else
            return DataTypeUtil.getCE(this.getLcModeCodeEtsId());
        return null;
    }


    public void setPreferenceInd(BL PreferenceInd)
    {
        this.setLcPreferenceFlag(PreferenceInd.toString());
    }


    public BL getPreferenceInd() throws Hl7Exception
    {
        return DataTypeUtil.getBL(this.getLcPreferenceFlag());
    }


    public void setProficiencyLevelCode(CE ce)
    {
        if (null != ce && ce.codeSystemEnName() != null && ce.codeName() != null)
        {
            setRimCoreEntyCdSets(ce, PROFICILEVELCODE);
        }
        else
        {
            this.setLcProficiLevelCodeEtsId(ce.code().toString());
        }
    }


    public CE getProficiencyLevelCode() throws Hl7Exception
    {
        if (this.getLcProficiLevelCodeEtsId().equals(PROFICILEVELCODE.toString()))
        {
            for (RimCoreEntyCdSets entityCdSets : this.getEntyCdSetsList())
            {
                if (this.getLcProficiLevelCodeEtsId().equals(entityCdSets.getAttributeTypeCode()))
                {
                    return DataTypeUtil.getCE(entityCdSets);
                }
            }
        }
        else
            return DataTypeUtil.getCE(this.getLcProficiLevelCodeEtsId());
        return null;
    }

    // LanguageCommunication
    @Column(name = "LC_LANGUAGE_CODE_ETS_ID")
    protected String lcLanguageCodeEtsId = LANGUAGECODE.toString();
    @Column(name = "LC_MODE_CODE_ETS_ID")
    protected String lcModeCodeEtsId = MODECODE.toString();
    @Column(name = "LC_PROFICI_LEVEL_CODE_ETS_ID")
    protected String lcProficiLevelCodeEtsId = PROFICILEVELCODE.toString();
    @Column(name = "LC_PREFERENCE_FLAG")
    protected String lcPreferenceFlag;


    protected void setLcLanguageCodeEtsId(String lcLanguageCodeEtsId)
    {
        this.lcLanguageCodeEtsId = lcLanguageCodeEtsId;
    }


    protected String getLcLanguageCodeEtsId()
    {
        return lcLanguageCodeEtsId;
    }


    protected void setLcModeCodeEtsId(String lcModeCodeEtsId)
    {
        this.lcModeCodeEtsId = lcModeCodeEtsId;
    }


    protected String getLcModeCodeEtsId()
    {
        return lcModeCodeEtsId;
    }


    protected void setLcProficiLevelCodeEtsId(String lcProficiLevelCodeEtsId)
    {
        this.lcProficiLevelCodeEtsId = lcProficiLevelCodeEtsId;
    }


    protected String getLcProficiLevelCodeEtsId()
    {
        return lcProficiLevelCodeEtsId;
    }


    protected void setLcPreferenceFlag(String lcPreferenceFlag)
    {
        this.lcPreferenceFlag = lcPreferenceFlag;
    }


    protected String getLcPreferenceFlag()
    {
        return lcPreferenceFlag;
    }

}
